using UnityEngine;

public class ASMRSwicher : MonoBehaviour
{
	[SerializeField]
	private GameObject[] soundObjects;

	private GameplayHaptic haptic;

	private GameProperties gameProperties;

	private void Start()
	{
		gameProperties = GetComponent<GameProperties>();
		haptic = GetComponent<GameplayHaptic>();
		SwichSound(gameProperties.IsSoundEnable());
		SwichHaptic(gameProperties.IsHapticEnable());
	}

	public void SwichSound(bool on)
	{
		for (int i = 0; i < soundObjects.Length; i++)
		{
			if (on)
			{
				soundObjects[i].GetComponent<ISwichSound>().SoundOn();
			}
			else
			{
				soundObjects[i].GetComponent<ISwichSound>().SoundOff();
			}
		}
	}

	public void SwichHaptic(bool on)
	{
		if (Application.platform == RuntimePlatform.Android)
		{
			haptic.HapticOff();
		}
		else if (on)
		{
			haptic.HapticOn();
		}
		else
		{
			haptic.HapticOff();
		}
	}
}
